# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer:
pkgname=gatling
pkgver=0.15
pkgrel=4
pkgdesc="High performance web server"
url="https://www.fefe.de/gatling/"
arch="x86_64 x86 ppc64le"
license="GPL-2.0"
depends=""
depends_dev=""
makedepends="openssl-dev libowfat-dev zlib-dev"
install="gatling.pre-install"
subpackages="$pkgname-doc"
source="https://www.fefe.de/$pkgname/$pkgname-$pkgver.tar.xz
	build-fixes.patch

	gatling.confd
	gatling.initd"

builddir="$srcdir/$pkgname-$pkgver"
build() {
	cd "$builddir"
	CFLAGS="$CFLAGS -std=c99"

	make prefix=/usr \
		CFLAGS="$CFLAGS -I/usr/include/libowfat" \
		LDFLAGS="$LDFLAGS" \
		gatling tlsgatling || return 1
}

package() {
	cd "$builddir"
	install -Dm644 gatling.1 \
		"$pkgdir"/usr/share/doc/man/man1/gatling.1 \
		|| return 1

	mkdir -p "$pkgdir"/usr/share/doc/$pkgname/
	install -m644 README.ftp README.http README.tls \
		"$pkgdir"/usr/share/doc/$pkgname/ \
		|| return 1

	mkdir -p "$pkgdir"/usr/bin/
	install -m755 gatling tlsgatling \
		"$pkgdir"/usr/bin/ || return 1

	install -Dm755 "$srcdir"/gatling.initd \
		"$pkgdir"/etc/init.d/gatling || return 1
	install -Dm644 "$srcdir"/gatling.confd \
		"$pkgdir"/etc/conf.d/gatling || return 1
}

sha512sums="b76d220a0644f1e6e7ea966a4eff409964c564fc4a31c4efdb764e5f7b5857bc58c26bc31e860fe35df932cbd60fb2b0f4f21c75cb5aa56427e8a2a453684716  gatling-0.15.tar.xz
888e3a3698a168313199d7d4ecbd48aae20de9d84e324322fdf1a7ebfab4d14af5f0d8ddf1b4475830d0e213ddac71f7db4efe50de0da8a0a2c8e95ed1ce9803  build-fixes.patch
b51e5145fa5f67dd933f8b7c06d633545152b253c51891ef4519b83707b0001034506a7a8807a37d104dcab47320a5233093d9d89211b36753ac316e447b54a9  gatling.confd
456ee7f2c62b682376f301b1727e32e68a53fe5b50bd9d9b1e00225e6d0e6bc62fa328b503ca2ebf899ff4c6ca68d9998785ee83749d4590c3c0196a5aadb133  gatling.initd"
